//
//  SecondViewController.m
//  UI07_DCIMHomework
//
//  Created by dllo on 16/6/14.
//  Copyright © 2016年 司昌宝. All rights reserved.
//

#import "SecondViewController.h"
#import "UIDcimScrollView.h"
@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self createDicmScrollView];
}

-(void)createDicmScrollView{
    UIDcimScrollView *dcimScrollView = [[UIDcimScrollView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    dcimScrollView.contentSize = CGSizeMake(6 * self.view.frame.size.width, 0);
    dcimScrollView.pagingEnabled = YES;
    dcimScrollView.contentOffset = CGPointMake(self.view.frame.size.width * self.index, 0);
    for (NSInteger i = 1; i <= 6; i++) {
        NSString *name = [NSString stringWithFormat:@"cat_%ld.jpg",i];
        UIImage *image = [UIImage imageNamed:name];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        imageView.frame = CGRectMake((i - 1) * self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height);
        [dcimScrollView addSubview:imageView];
    }
    [self.view addSubview:dcimScrollView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
